﻿using System.Web.UI;
using System;
using System.Web.UI.WebControls;

using SiteUnity.Layers.Application.BaseClasses;

namespace SiteUnity.Frame.Modules
{
    [ToolboxData("<{0}:AssetsManager runat=server/>")]
    public class AssetsManager : BaseWebControl
    {
        protected override void OnPreRender(EventArgs e)
        {
            //Adds Css
            string path = Page.ClientScript.GetWebResourceUrl(this.GetType(), "SiteUnity.Frame.Modules.Assets.StyleSheet.css");
            System.Web.UI.WebControls.Literal cssFile = new System.Web.UI.WebControls.Literal() { Text = @"<link href=""" + Page.ResolveUrl(path) + @""" type=""text/css"" rel=""stylesheet"" />" };
            Page.Header.Controls.AddAt(0,cssFile);

            //Adds JS
            Page.ClientScript.RegisterClientScriptInclude(typeof(MasterPage), "SU_Javascript", Page.ClientScript.GetWebResourceUrl(this.GetType(), "SiteUnity.Frame.Modules.Assets.Javascript.js"));
        }
    }
}
